home *** CD-ROM | disk | FTP | other *** search
Wrap
#! /bin/sh # postinst script for cups # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * <postinst> `configure' <most-recently-configured-version> # * <old-postinst> `abort-upgrade' <new version> # * <conflictor's-postinst> `abort-remove' `in-favour' <package> # <new-version> # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' # <failed-install-package> <version> `removing' # <conflicting-package> <version> # for details, see /usr/doc/packaging-manual/ # # quoting from the policy: # Any necessary prompting should almost always be confined to the # post-installation script, and should be protected with a conditional # so that unnecessary prompting doesn't happen if a package's # installation fails and the `postinst' is called with `abort-upgrade', # `abort-remove' or `abort-deconfigure'. # Debconf . /usr/share/debconf/confmodule # Default Configuration file if [ -e /etc/default/cups ]; then . /etc/default/cups fi case "$1" in configure) # Set up lpadmin group. if [ -z "`getent group lpadmin`" ]; then addgroup --system lpadmin fi if [ -L /usr/share/ppd/cups-transitional-dir ]; then rm -f /usr/share/ppd/cups-transitional-dir fi if [ -L /usr/share/cups/model/cups-included ]; then rm -f /usr/share/cups/model/cups-included fi # Generate raw MIME handling files if they don't already exist. if [ ! -e /etc/cups/raw.types ]; then cat >/etc/cups/raw.types <<EOF # This file was generated by the cups package. You may change it, or # reconfigure this file with dpkg-reconfigure. If it is removed, it # will be regenerated by the package scripts. application/octet-stream EOF fi if [ ! -e /etc/cups/raw.convs ]; then cat >/etc/cups/raw.convs <<EOF # This file was generated by the cups package. You may change it, or # reconfigure this file with dpkg-reconfigure. If it is removed, it # will be regenerated by the package scripts. application/octet-stream application/vnd.cups-raw 0 - EOF fi # Set up raw printing of application/octet-stream if desired. db_fget cupsys/raw-print changed if [ "$RET" = "true" ]; then mv /etc/cups/raw.convs /etc/cups/raw.convs-convert db_get cupsys/raw-print if [ "$RET" = "true" ]; then sed 's/^\s*#\s*application/application/' \ < /etc/cups/raw.convs-convert > /etc/cups/raw.convs else sed 's/^application/#application/' \ < /etc/cups/raw.convs-convert > /etc/cups/raw.convs fi rm -f /etc/cups/raw.convs-convert db_fset cupsys/raw-print changed false fi # Set up backends db_get cupsys/backend && SELECTED=$RET list=`echo $SELECTED | sed -e 's/, /,/g'` save_IFS=$IFS IFS=, (cd /usr/lib/cups/backend && rm -f http ipp lpd parallel scsi serial socket usb snmp dnssd) for module in $list; do ln /usr/lib/cups/backend-available/$module /usr/lib/cups/backend/$module if [ "$module" = "ipp" ]; then ln /usr/lib/cups/backend/ipp /usr/lib/cups/backend/http fi done IFS=$save_IFS # activate new backends on upgrades db_fset cupsys/backend changed false if dpkg --compare-versions "$2" lt-nl "1.3.4-2"; then for module in snmp scsi serial dnssd; do [ -e /usr/lib/cups/backend/$module ] || \ ln /usr/lib/cups/backend-available/$module /usr/lib/cups/backend/$module done fi # Resync Debconf database with real state list=`( cd /usr/lib/cups/backend && for f in ipp lpd parallel scsi serial socket usb snmp dnssd; do [ -e $f ] && echo -n "$f, "; done ) | sed -e 's/, $//'` db_set cupsys/backend $list; if [ -f /etc/cups/classes.conf ]; then chown root:lp /etc/cups/classes.conf ; chmod 600 /etc/cups/classes.conf fi if [ -f /etc/cups/printers.conf ]; then chown root:lp /etc/cups/printers.conf ; chmod 600 /etc/cups/printers.conf fi # Add symlink to local files required by LSB if [ ! -e /usr/share/ppd/1-local-admin -a ! -L /usr/share/ppd/1-local-admin ]; then ln -s /usr/local/share/ppd /usr/share/ppd/1-local-admin fi if [ ! -e /usr/share/ppd/2-third-party -a ! -L /usr/share/ppd/2-third-party ]; then ln -s /opt/share/ppd /usr/share/ppd/2-third-party fi # symlink snakeoil SSL certificate if present if [ -e /etc/ssl/certs/ssl-cert-snakeoil.pem -a \ -e /etc/ssl/private/ssl-cert-snakeoil.key -a \ -n "`getent group ssl-cert`" -a ! -e /etc/cups/ssl/server.crt -a \ ! -e /etc/cups/ssl/server.key ]; then ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/cups/ssl/server.crt ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/cups/ssl/server.key fi # Remove shutdown and reboot links; this init script does not need them. if dpkg --compare-versions "$2" lt-nl "1.3.6-2"; then rm -f /etc/rc0.d/K??cups /etc/rc6.d/K??cups fi # Reload AppArmor profile if present if [ -e /etc/apparmor.d/usr.sbin.cupsd ] && [ -x /etc/init.d/apparmor ]; then invoke-rc.d apparmor force-reload || true fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. # Automatically added by dh_installdocs if [ "$1" = configure ] && which install-docs >/dev/null 2>&1; then install-docs -i /usr/share/doc-base/cups fi # End automatically added section # Automatically added by dh_installinit if [ -x "/etc/init.d/cups" ]; then update-rc.d cups start 20 2 3 4 5 . stop 80 1 . >/dev/null if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then invoke-rc.d cups start || exit $? else /etc/init.d/cups start || exit $? fi fi # End automatically added section # Automatically added by dh_usrlocal if [ "$1" = configure ]; then ( while read line; do set -- $line dir="$1"; mode="$2"; user="$3"; group="$4" if [ ! -e "$dir" ]; then if mkdir "$dir" 2>/dev/null; then chown "$user":"$group" "$dir" chmod "$mode" "$dir" fi fi done ) << DATA /usr/local/share 2775 root staff /usr/local/share/ppd 2775 root staff DATA fi # End automatically added section db_stop exit 0